<template>
	<view class="myWithdrawalType">
		<u-navbar title="支付管理" title-color="#333" back-icon-color="#333"></u-navbar>
		<view class="myWithdrawalType-bottom">
			<view class="myWithdrawalType-car">
				<view class="myWithdrawalType-add" @click="addmyWithdrawalType">
					<text class="myWithdrawalType-add-button">添加账户类型</text>
				</view>
			</view>
			<view class="myWithdrawalType-content-box" v-if="myWithdrawalTypeArrList.length!=0" v-for="(item,index) of myWithdrawalTypeArrList" :key="index">
				<view class="myWithdrawalType-content-bottom">
					<view class="myWithdrawalType-carName-phone">
						<view class="deliveryPlace-carName">
							<text class="myWithdrawalType-phone">账户类型:</text>
							<text class="myWithdrawalType-input-money">{{item.SETTB406CA02}}</text>
						</view>
					</view>
					<view class="myWithdrawalType-carName-phone">
						<view class="deliveryPlace-carName">
							<text class="myWithdrawalType-phone">账号:</text>
							<text class="myWithdrawalType-input-money">{{item.SETTB406CA03}}</text>
						</view>
					</view>
					<view class="myWithdrawalType-carName-phone">
						<view class="deliveryPlace-carName">
							<text class="myWithdrawalType-phone">收款人:</text>
							<text class="myWithdrawalType-input-money">{{item.SETTB406CA04}}</text>
						</view>
					</view>
					<view class="myWithdrawalType-button-box">
						<view class="myWithdrawalType-add" @click="prohibit(item)" style="background: rgba(255, 76, 76, 1);" >
							<text class="myWithdrawalType-add-button">解绑</text>
						</view>
					</view>
				</view>
			</view>
			<view class="sendorder-loadmore">
				<u-loadmore v-if="myWithdrawalTypeArrList.length!=0" :status="status" :icon-type="iconType" :load-text="loadText" />
			</view>
			<!-- 缺醒页 -->
			<view class="zanWSJ" v-if="myWithdrawalTypeArrList.length==0">
				<image :src="getStaticFilePath('/QXY/noData.png')" alt="">
			</view>
			<u-modal v-model="myWithdrawalTypeLoginShow" :content="myWithdrawalTypeContent" :show-cancel-button="true" @confirm="myWithdrawalTypeConfirm"></u-modal>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo: JSON.parse(uni.getStorageSync('userinfo')),
				status: 'loading',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				countpage: 1,
				page: 1,
				myWithdrawalTypeArrList: [1],
				myWithdrawalTypeLoginShow: false,
				myWithdrawalTypeContent: '',
				
			}
		},
		onShow() {
			
			this.myWithdrawalTypeList()
		},
		onReachBottom() {
			// if (this.page == this.countpage) {
			// 	return this.status = "nomore"
			// }
			// this.page++
			// this.myWithdrawalTypeList()
		},
		methods: {
			// 删除
			myWithdrawalTypeConfirm() {
				uni.request({
					url: this.baseUrl + '/orm/ormtb421/deleteSettb406/'+this.myWithdrawalTypeid,
					method: 'GET',
					success: (res) => {
						// console.log(res);
						if (res.data.code == 200) {
							this.$refs.uToast.show({
								title: '解绑成功',
								type: 'default',
								icon:false
							})
							this.myWithdrawalTypeid=''
							this.myWithdrawalTypeList();
						} else {
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon:false
							})
						}
					},
					fail: (res) => {
						uni.showToast({
							title: res.errMsg,
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			prohibit(item) {
				this.myWithdrawalTypeLoginShow = true
				this.myWithdrawalTypeid = item.SETTB406ID
				this.myWithdrawalTypeContent = '您确定是否解绑：' + item.SETTB406CA02 + '？'
			},
			//添加
			addmyWithdrawalType() {
				uni.navigateTo({
					url: '../myWithdrawalTypeAdd/index'
				})
			},
			myWithdrawalTypeList() {
				uni.showLoading({
					title: '请求中...',
					mask: true
				});
				this.status = "loading"
				uni.request({
					url: this.baseUrl + '/orm/ormtb421/selectSettb406/'+this.userinfo.ORMTB410ID,
					method: 'GET',
					success: (res) => {
						uni.hideLoading();
						console.log(res);
						if (res.data.code == 200) {
							if (!res.data.data || res.data.data == null) {
								this.myWithdrawalTypeArrList = []
								return
							}
							this.myWithdrawalTypeArrList = res.data.data || []
						} else {
							this.myWithdrawalTypeArrList = []
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon:false
							})
						}
						if (this.countpage == this.page) {
							this.status = "nomore"
						} else {
							this.status = "loadmore"
						}
					},
					fail: (res) => {
						if (this.countpage == this.page) {
							this.status = "nomore"
						} else {
							this.status = "loadmore"
						}
						uni.hideLoading();
						this.$refs.uToast.show({
							title: res.errMsg,
							type: 'default',
							icon:false
						})
					}
				});
			},
		}
	}
</script>

<style scoped>
	.sendorder-loadmore {
		padding: 20rpx 0 20rpx 0;
	}

	.myWithdrawalType .zanWSJ {
		padding-top: 200rpx;
	}

	.myWithdrawalType .zanWSJ>image {
		display: block;
		margin: 0 auto;
		height: 360rpx;
		width: 43%;
	}


	.myWithdrawalType {
		width: 100%;
		min-height: 100vh;
		background-color: rgba(242, 242, 242, 1);
		overflow: hidden;
	}

	/* 列表 */

	.myWithdrawalType .myWithdrawalType-car {
		width: 100%;
		background: rgba(255, 255, 255, 1);
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		padding: 24rpx;
	}

	.myWithdrawalType .myWithdrawalType-car-box {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.myWithdrawalType .myWithdrawalType-stick {
		width: 6rpx;
		height: 29rpx;
		display: inline-block;
		background: linear-gradient(0deg, rgba(57, 163, 216, 1), rgba(35, 199, 217, 1));
		border-radius: 8px;
		margin-right: 16rpx;
		line-height: 29rpx;
		position: relative;
		top: 2rpx;
	}

	.myWithdrawalType .myWithdrawalType-car-details {
		font-size: 32rpx;
		color: rgba(51, 51, 51, 1);
		height: 29rpx;
		line-height: 29rpx;
		/* height: 0.37rem;
	  line-height: 0.37rem; */
	}

	/* 添加 */
	.myWithdrawalType-add {
		height: 44rpx;
		font-size: 28rpx;
		color: rgba(255, 254, 254, 1);
		background: rgba(0, 160, 241, 1);
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.myWithdrawalType .icontianjia,
	.myWithdrawalType .iconxiugai,
	.myWithdrawalType .iconbaocun,
	.myWithdrawalType .iconshanchu,
	.myWithdrawalType .iconqiyong {
		font-size: 26rpx;
		padding-left: 10rpx;
	}

	.myWithdrawalType-add-button {
		padding: 0 10rpx;
	}

	/* 内容 */
	.myWithdrawalType-content-box {
		width: 100%;
		background: rgba(255, 255, 255, 1);
	}

	.myWithdrawalType .myWithdrawalType-content {
		margin-top: 8rpx;
		border-bottom: 2rpx solid rgba(230, 230, 230, 1);
	}

	.myWithdrawalType .myWithdrawalType-carNumber {
		font-size: 30rpx !important;
		font-weight: bold;
	}

	.myWithdrawalType .myWithdrawalType-bottom view:nth-child(3)>view:first-child text:first-child {}

	.myWithdrawalType .myWithdrawalType-button-box {
		display: flex;
		justify-content:flex-end;
		padding: 30rpx 0;
	}

	.myWithdrawalType-button-margin {
		margin-right: 20rpx;
	}

	.myWithdrawalType-content-bottom {
		padding: 0 24rpx;
	}

	.myWithdrawalType-carName-phone {
		border-bottom: 2rpx solid rgba(230, 230, 230, 1);
		display: flex;
		justify-content: space-between;
		padding: 18rpx 0;
	}

	.myWithdrawalType input {
		display: inline-block;
		margin-bottom: 0 !important;
		padding: 0 !important;
		height: 43rpx !important;
		margin-left: 7rpx;
		color: rgba(51, 51, 51, 1);
		font-size: 30rpx;
		text-align: center;
		border: 2rpx solid rgba(0, 0, 0, .2);
		border-radius: 6rpx;
	}

	.inputBorder {
		border: none !important;
		text-align: left !important;
	}
	.deliveryPlace-carName{
		width: 100%;
	}
	.myWithdrawalType-input-money {
		width: 80% !important;
		display: inline-block;
		text-align: right;
	}

	.myWithdrawalType-input-two {
		width: 190rpx !important;
	}

	.myWithdrawalType-phone {
		width: 122rpx;
		display: inline-block;
		font-size: 30rpx;
		color: rgba(153, 153, 153, 1);
	}

	.myWithdrawalType-tare {
		padding: 18rpx 0;
	}

	.myWithdrawalType-dun {
		color: rgba(51, 51, 51, 1);
		font-size: 30rpx;
	}
</style>
